#include "Element_date.h"

Elenemt_data hqyj_24071[50] =
    {
        {.id = 1, .age = 18, .sco = 100, .sex = "男", .name = "唐三"},
        {.id = 2, .age = 18, .sco = 99, .sex = "男", .name = "萧炎"},
        {.id = 3, .age = 18, .sco = 99, .sex = "男", .name = "叶晨"},
        {.id = 4, .age = 18, .sco = 99, .sex = "女", .name = "小舞"},
        {.id = 5, .age = 18, .sco = 99, .sex = "女", .name = "萧熏儿"},
        {.id = 6, .age = 18, .sco = 99, .sex = "女", .name = "柳如烟"},
};
void main_page ()
{
    Sql_list list;
    Sql_list * L = &list;
    Init_Sql_List(L);
    for (int i = 0; i < 6; i++)
    {
        tail_insert_tail(L , hqyj_24071[i]);
    }
    int i , j;
    char str_1[128];
    char str_5[128];
    while (1)
    {
        printf("菜单界面\n");
        printf("这是我们要操作的结构体数组：\n");
        printf_Sql_List(L);
        printf("请通过数字键进入你想进行的操作：\n");
        printf("1.通过名字删除并打印删除的对象\t2.删除最后一位学生并打印删除的对象\n3.通过名字改变学生的成绩\t4.通过名字查成绩\n5.切换账号\n");
        scanf("%d", &i);
        while (1)
    {
        if (i==1||i==2||i==3||i==4||i==5)
        {
            break;
        }
        else {printf("未识别到有效数字，请重新输入\n");}
        getchar();
    }
    switch (i)
    {
    case 1 :
    printf("请输入要查找的学生的名字：");
    scanf("%s",str_1);
    find_by_name( L , str_1);

        break;
    case 2:
        
        break;
    case 3:
        
        break;
    case 4:
        printf("请输入要查找的学生的名字：");
        scanf("%s",str_5);
        int os =find_by_name(L ,str_5);
        printf("%s的成绩是:%d\n",str_5,hqyj_24071[os-1].sco);
        break;
    case 5: return;
        }
    }
}